{foreach $hotelArray as $hotel}
    <input id="hotelId_hidden_{$hotel.hotelId}" value="{$hotel.hotelId}" type="hidden"/>
    <div id="hotel-division">
        <div id="hotel-ribbon-offers" class="hidden border-on" >
            <img src="" />
            <span>Promotion:</span>
            <span id="hotel-text">Discount 30 % -- Book now !&nbsp;&nbsp;&nbsp;</span>
        </div>
        <div id="hotel-data" class="border-on marginless" >
            <img class="thumbnailImage inline-block left" src="{$hotel.thumbnailUrl}" id="thumb{$hotel.hotelId}"/>
            <div id="hotel-content" class="inline-block right">
                <span id="hotel-name-price">
                    <h3 class="left">{$hotel.hotelName} </h3>
                    <h3 class="right" id="price_text">Avg rate: {intval(($hotel.lRate))} {$hotel.rateCurrencyCode}</h3>
                </span>
                <span id="hotel-short-desc" >{$hotel.shortDesc|unescape:"htmlall"}</span>
            </div>
        </div>
        <div id="hotel_tabs">
            <div>
                <table cellspacing="0" id="tabs_table">
                    <tr>
                        <td id="hotel_details_tab{$hotel.hotelId}" 
                            class="hotel_details_tab" 
                            onmouseover="a_hover(1,{$hotel.hotelId});"  
                            onmouseout="a_mouseout(1,{$hotel.hotelId});" 
                            onclick="a_click(1,{$hotel.hotelId});grabData('INFO',{$hotel.hotelId},{$hotel.hotelId});">
                            <input type="hidden" id="tb_hotel_hidden{$hotel.hotelId}" value="0" />
                            <label id="hotels_tb{$hotel.hotelId}" class="hotels_tb"   
                                   onmouseover="a_hover(1,{$hotel.hotelId});" 
                                   onmouseout="a_mouseout(1,{$hotel.hotelId});">Hotels Details</label>
                        </td>
                        <td id="room_details_tab{$hotel.hotelId}"
                            class="room_details_tab"
                            onclick="a_click(2,{$hotel.hotelId});grabData('AVAIL',{$hotel.hotelId},{$hotel.hotelId});">
                            
                            <input type="hidden" id="tb_room_hidden{$hotel.hotelId}" value="0" />
                            <label id="room_tb{$hotel.hotelId}"
                                   class="room_tb" 
                                   >Check Availability</label>
                        </td>
                        <td id="galery_tab{$hotel.hotelId}"
                            class="galery_tab"  
                            onmouseover="a_hover(3,{$hotel.hotelId});" 
                            onclick="a_click(3,{$hotel.hotelId}); grabData('IMG',{$hotel.hotelId},{$hotel.hotelId});" 
                            onmouseout="a_mouseout(3,{$hotel.hotelId});">
                            <input type="hidden" id="tb_galery_hidden{$hotel.hotelId}" value="0" />
                            <label class="galery_tb" id="galery_tb{$hotel.hotelId}" 
                                   onmouseover="a_hover(3,{$hotel.hotelId});" 
                                   onmouseout="a_mouseout(3,{$hotel.hotelId});">Galery </label>
                        </td>
                        <td></td>
                        <td width="200px"></td>
                        <td class="hotel_options">
                            Star Rating <img id="star_rating" src="./images/rating/star{$hotel.rating}.png"  height="15" />
                        </td>

                    </tr>
                </table>
            </div>
            <div class="hotels" id="hotels{$hotel.hotelId}" style="display:none;"></div>
            <div class="rooms" id="rooms{$hotel.hotelId}" style="display:none;"></div>
            <div class="galery"  id="galery{$hotel.hotelId}" style="display:none;"></div>
        </div>
    </div>
{/foreach}
{literal}
    <script> 
        var grabData = function(service, id, hotelId){
            var field,
                data={
                    service: service,
                    hotelId: hotelId,
                    token: id,
                    thumbnailImage: $("#thumb"+hotelId).attr("src")
                };
            switch(service){
                case "AVAIL":
                    field = $("#rooms"+id);

                    break;
                case "INFO":
                    field = $("#hotels"+id);
                    break;
                case "IMG":
                    field = $("#galery"+id);
                    break;
                case "CANCEL":
                    field = $("#cancelationPolicy"+id);
                    var idx =id.slice(0,id.indexOf('_'));
                    data={
                        service: service,
                        hotelId: hotelId,
                        token: idx,
                        supplierType: $("#supplierType"+idx).val(),
                        roomTypeCode: $("#roomCode"+idx).val(),
                        rateCode: $("#roomRateCode"+idx).val(),
                        rateKey: $("#roomRateKey"+idx).val()
                    };
                    console.log(id.slice(0,id.indexOf('_')));
                    break;
                default:
                    break;
            }

            ajaxCall("POST","data_grabber.php",data,field);
        };
    </script> 
{/literal}